import time, datetime

#
# print(datetime.datetime.now())#获取当前时间
#
# nowtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())#获取当前时间常用
# print(nowtime)
#
# nowtime1 = time.localtime(time.time())
# print(nowtime1)


# ts = datetime.datetime.now().timestamp()#获取当前时间戳
# print(ts)
#
#
# now = int(time.time())#获取当前时间戳
# print(now)
#
# Array= time.localtime(now)#转化为数组
# print(Array)
#
#
# nowtime=time.strftime("%Y-%m-%d %H:%M:%S", Array)#将时间戳转化为北京时间
# print(nowtime)
#



""" year month day  hour   minute seconds
   
"""

# print(time.localtime())
print(time.strftime("%H%M%S")) #获取当前时间
print(time.strftime("%Y%m%d%H%M%S"))
#
# """日期格式转换函数，2021-02-09 14:15:29转换为20210209141529"""
# def global_strtime(timenum):
#     yearmontime = timenum.split("-")
#     daytime = yearmontime[2].split(" ")
#     hoersc = daytime[1].split(":")
#     print(yearmontime[0]+yearmontime[1]+daytime[0]+hoersc[0]+hoersc[1]+hoersc[2])
#     return (yearmontime[0].strip()+yearmontime[1]+daytime[0]+hoersc[0]+hoersc[1]+hoersc[2]).strip()
# global_strtime("2021-05-25 17:29:47")
#
#
#
# # """str类型的日期转换为时间戳"""
# tss1 = '2013-10-10 23:40:00'
# timeArray = time.strptime(tss1, "%Y-%m-%d %H:%M:%S") # 转为时间数组
# print (timeArray)
# # print (timeArray.tm_year)# timeArray可以调用tm_year等
#
# timeStamp =int(time.mktime(timeArray)) # 转为时间戳
# print (timeStamp)


#
# """时间戳转换为指定格式的日期"""
# # 使用time
# timeStamp = 1381419600
# timeArray = time.localtime(timeStamp)
# otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
# print(otherStyleTime)   # 2013--10--10 23:40:00
#
# # 使用datetime
# timeStamp = 1381419600
# dateArray = datetime.datetime.fromtimestamp(timeStamp)
# otherStyleTime = dateArray.strftime("%Y-%m-%d %H:%M:%S")
# print(otherStyleTime)   # 2013--10--10 23:40:00
#
# # 使用datetime，指定utc时间，相差8小时
# timeStamp = 1381419600
# dateArray = datetime.datetime.utcfromtimestamp(timeStamp)
# otherStyleTime = dateArray.strftime("%Y-%m-%d %H:%M:%S")
# print(otherStyleTime)   # 2013--10--10 15:40:00

